package com.jinmdz.fmis.mapper.mapper;

import org.apache.ibatis.annotations.*;
import com.jinmdz.fmis.mapper.mapper.provider.CremationFurnaceViewProvider;
import com.jinmdz.fmis.mapper.entity.CremationFurnaceViewEntity;

import java.util.ArrayList;

/**
 * 火化炉炕面连接开关关联表Mapper
 * 
 * @author generator
 * @date 2020-08-23 18:11
 */
public interface CremationFurnaceViewMapper {

    /**
     * 增加CremationFurnaceView
     * 
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @InsertProvider(type = CremationFurnaceViewProvider.class, method = "insertCremationFurnaceView")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertCremationFurnaceView(@Param("entity") CremationFurnaceViewEntity entity);

    /**
     * 删除CremationFurnaceView
     * 
     * @param id 主键
     * @param modifiedUserId 修改用户外键
     * @param version 版本号
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @Update(" update cremation_furnace_view set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForCremationFurnaceView(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改CremationFurnaceView
     * 
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @UpdateProvider(type = CremationFurnaceViewProvider.class, method = "updateCremationFurnaceView")
    void updateCremationFurnaceView(@Param("entity") CremationFurnaceViewEntity entity);

    /**
     * 查询CremationFurnaceView实体
     * 
     * @param id 主键
     * @return CremationFurnaceViewEntity
     * @author generator
     * @date 2020-08-23 18:11
     */
    @Select(" select id,deleted,business_code,cremation_id,furnace_id,camera_id,process_state_code,open_time,close_time,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from cremation_furnace_view where id = #{id} and deleted = 0 limit 1 ")
    CremationFurnaceViewEntity getCremationFurnaceViewById(@Param("id") Integer id);

    /**
     * 查询CremationFurnaceView列表
     * 
     * @param entity 数据实体
     * @return CremationFurnaceViewEntity
     * @author generator
     * @date 2020-08-23 18:11
     */
    @SelectProvider(type = CremationFurnaceViewProvider.class, method = "listCremationFurnaceView")
    ArrayList<CremationFurnaceViewEntity> listCremationFurnaceView(@Param("entity") CremationFurnaceViewEntity entity);
}